
CFAdata_3<-subset(limited, 
                    Obedient >-1 & Respect >-1 & GoodMannered >-1 & WellBehaved >-1 & Polite>-1 &
                      Orderly>-1 &Disciplined>-1 &Loyal>-1)


bin.mod <- '
author =~ NA*Obedient + Respect + GoodMannered + WellBehaved+Polite+
    Orderly+Disciplined+Loyal'
## Must SIMULTANEOUSLY constrain thresholds, loadings, and intercepts
test.seq <- list(strong = c("thresholds","loadings","intercepts"),
                 means = "means",
                 strict = "residuals")
meq.list <- list()
for (i in 0:length(test.seq)) {
  if (i == 0L) {
    meq.label <- "configural"
    group.equal <- ""
    long.equal <- ""
  } else {
    meq.label <- names(test.seq)[i]
    group.equal <- unlist(test.seq[1:i])
    # long.equal <- unlist(test.seq[1:i])
  }
  meq.list[[meq.label]] <- measEq.syntax(configural.model = bin.mod,
                                         data = CFAdata_3,
                                         ordered = c("Obedient",  
                                                     "Respect",
                                                     "GoodMannered",  
                                                     "WellBehaved", 
                                                     "Polite", 
                                                     "Orderly", 
                                                     "Disciplined",
                                                     "Loyal"),
                                         parameterization = "theta",
                                         ID.fac = "std.lv",
                                         ID.cat = "Wu.Estabrook.2016",
                                         group = "treatment",
                                         group.equal = group.equal,
                                         #longFacNames = longFacNames,
                                         #long.equal = long.equal,
                                         return.fit = TRUE)
}

summary(compareFit(meq.list))

